package com.hf.eagle.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hf.eagle.dao.ModPopedomDao;
import com.hf.eagle.domain.ModPopedom;
import com.hf.eagle.service.ModPopedomService;

/**
 * @author Xu,XiaoYuan
 * @version 2011-09-06 23:44
 */
@Service
public class ModPopedomServiceImpl implements ModPopedomService {

	@Resource
	private ModPopedomDao modPopedomDao;

	public Long createModPopedom(ModPopedom t) {
		return this.modPopedomDao.insertEntity(t);
	}

	public ModPopedom getModPopedom(ModPopedom t) {
		return this.modPopedomDao.selectEntity(t);
	}

	public Long getModPopedomCount(ModPopedom t) {
		return this.modPopedomDao.selectEntityCount(t);
	}

	public List<ModPopedom> getModPopedomList(ModPopedom t) {
		return this.modPopedomDao.selectEntityList(t);
	}

	public int modifyModPopedom(ModPopedom t) {
		ModPopedom mpd = new ModPopedom();
		mpd.getMap().put("user_id", t.getUser_id());
		modPopedomDao.deleteEntity(mpd);

		List<ModPopedom> modPopedomList = t.getModPopedomList();
		if (null != modPopedomList && modPopedomList.size() > 0) {
			for (ModPopedom modPopedom : modPopedomList) {
				modPopedomDao.insertEntity(modPopedom);
			}
		}

		return 1;
	}

	public int removeModPopedom(ModPopedom t) {
		return this.modPopedomDao.deleteEntity(t);
	}

	public List<ModPopedom> getModPopedomPaginatedList(ModPopedom t) {
		return this.modPopedomDao.selectEntityPaginatedList(t);
	}

}
